#ifdef __EOS__
#include <rtthread.h>
#else
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/printk.h>
#include <linux/version.h>
#include <linux/of_platform.h>
#endif

#include "ei_type.h"
#include "ei_common.h"
#include "ei_os.h"
/* #include "aenc.h" */

extern int  AENC_TEST_SINK_Init(void);
extern int  AENC_TEST_SINK_Exit(void);
extern int AENC_ModInit(void);
extern void AENC_ModExit(void);

#ifdef __EOS__
int aenc_driver_init(void)
{
    os_printk("%s\n", "aenc init ok");

    AENC_ModInit();
    AENC_TEST_SINK_Init();

    return 0;
}

#else /* __EOS__ */

static int ei_aenc_probe(struct platform_device *pdev)
{
    os_printk("%s\n", "aenc init ok");

    AENC_ModInit();
    AENC_TEST_SINK_Init();

    return 0;
}

static int ei_aenc_remove(struct platform_device *pdev)
{
    os_printk("%s\n", "aenc exit ok");

    AENC_TEST_SINK_Exit();
    AENC_ModExit();

    return 0;
}

static const struct of_device_id ei_aenc_match[] = {
    { .compatible = "ei, ei-aenc" },
    {},
};

MODULE_DEVICE_TABLE(of, ei_aenc_match);

static struct platform_driver ei_aenc_driver = {
    .probe          = ei_aenc_probe,
    .remove         = ei_aenc_remove,
    .driver         =
    {
        .name           = "ei_aenc",
        .of_match_table = ei_aenc_match,
    },
};

os_module_platform_driver(ei_aenc_driver);

MODULE_LICENSE("Proprietary");

#endif /* __EOS__ */

